package com.ims.core.doc.mapper;

import java.util.List;
import java.util.Map;

import com.ims.core.doc.domain.TScSettlebill;
import com.ims.core.doc.domain.TScSettlebillEntry;
import com.ims.core.doc.domain.TScSettlebillEntryForinvoice;

/**
 * 结算单Mapper接口
 *
 * @author IMS
 * @date 2024-05-30
 */
public interface TScSettlebillMapper
{
    /**
     * 查询结算单
     *
     * @param id 结算单主键
     * @return 结算单
     */
    public TScSettlebill selectTScSettlebillById(Long id);
    /**
     * 查询结算单
     *
     * @param ids 结算单主键
     * @return 结算单
     */
    public List<TScSettlebill> selectTScSettlebillByIds(Long[] ids);

    /**
     * 查询结算单列表
     *
     * @param tScSettlebill 结算单
     * @return 结算单集合
     */
    public List<TScSettlebill> selectTScSettlebillList(TScSettlebill tScSettlebill);

    /**
     * 新增结算单
     *
     * @param tScSettlebill 结算单
     * @return 结果
     */
    public int insertTScSettlebill(TScSettlebill tScSettlebill);

    /**
     * 修改结算单
     *
     * @param tScSettlebill 结算单
     * @return 结果
     */
    public int updateTScSettlebill(TScSettlebill tScSettlebill);

    /**
     * 删除结算单
     *
     * @param id 结算单主键
     * @return 结果
     */
    public int deleteTScSettlebillById(Long id);

    /**
     * 批量删除结算单
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTScSettlebillByIds(Long[] ids);

    /**
     * 批量删除结算单明细项
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTScSettlebillEntryBySettleIds(Long[] ids);

    /**
     * 批量新增结算单明细项
     *
     * @param tScSettlebillEntryList 结算单明细项列表
     * @return 结果
     */
    public int batchTScSettlebillEntry(List<TScSettlebillEntry> tScSettlebillEntryList);

    /**
     * 批量新增结算单明细项
     *
     * @param tScSettlebillEntryForinvoiceList 结算单明细项列表
     * @return 结果
     */
    public int batchTScSettlebillEntryForinvoice(List<TScSettlebillEntryForinvoice> tScSettlebillEntryForinvoiceList);

    /**
     * 标记删除结算单可开票明细
     * @param params
     */
    public void deleteTScSettlebillEntryForinvoiceBySettleId(Map<String, String> params);


    /**
     * 通过结算单主键删除结算单明细项信息
     *
     * @param settleId 结算单ID
     * @return 结果
     */
    public int deleteTScSettlebillEntryBySettleId(String settleId);

    /**
     * 查询某结算单当前有效的可开票明细
     * @param settleId
     * @return
     */
    public List<TScSettlebillEntryForinvoice> selectLastTScSettlebillEntryForinvoiceList(String settleId);

    /**
     * 查询某结算单，某开票单 的可开票明细
     * @param params
     * @return
     */
    public List<TScSettlebillEntryForinvoice> selectTScSettlebillEntryForinvoiceListBySettleIdAndApplyNo(Map<String, String> params);

    /**
     * 给传入的物料明细做合并
     * @param tScSettlebillEntryForinvoices
     * @return
     */
    public List<TScSettlebillEntryForinvoice> getNewTScSettlebillEntryForinvoiceList(List<TScSettlebillEntryForinvoice> tScSettlebillEntryForinvoices);

    /**
     * 查询某批结算单当前有效的可开票明细
     * @param ids
     * @return
     */
    public List<TScSettlebillEntry> selectMergeTScSettlebillList(Long[] ids);

    /**
     *
     * @param invNum
     * @return
     */
    public String getInvoiceTypeByInvNum(String invNum);
}
